package activation;

public class SigmoidLog implements ActivationFunction
{
	private double k;
	private double scale;
	private double translate;
	
	public SigmoidLog(double k)
	{
		this.k=k;
		scale = 1;
		translate=0;
	}
	
	public SigmoidLog(double k, double min, double max) {
		this.k=k;
		scale = max-min;
		translate = min;
	}

	public double getActivation(double membranePotential){
		double ret = 1/(1+Math.exp(-k*membranePotential))*scale+translate;
		return ret;
	}
	
	public double getActivationDerivative(double membranePotential){
		double ret = scale*k*Math.exp(-k*membranePotential)/Math.pow((1+Math.exp(-k*membranePotential)),2);
		return ret;
	}
	public String toString()
	{
		return "SigmodLog{ k:"+k+" min: "+translate+" max: "+(scale+translate)+" }";
	}
}